<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<script LANGUAGE="javascript">
function redirectPageComplete(str)
{	
	alert("ลบ email สำเร็จ");
	location = "../../emails.php";
}

function redirectPageIncomplete()
{
	alert("เกิดข้อผิดพลาดในการลบข้อมูล");
	location = "../../emails.php";
}

function redirectPageIsnull()
{
	alert("ข้อมูลบางส่วนยังเป็นค่าว่าง กรุณาลงใหม่อีกครั้ง");
	location = "../../emails.php";
	
}

<?php
include '../../../inc/reuse/dbconfig.php';
$emails_id = addslashes($_GET['emails_id']);
if(isset($emails_id)){
	$sql = "DELETE FROM emails
			WHERE emails_id=$emails_id";
	if(mysql_query($sql)){
	 	echo "redirectPageComplete();";
	}else{	
		echo "redirectPageIncomplete();";
	}	
	mysql_close();	
}
else
{
	echo "redirectPageIsnull();";
}
?>
</script>
</body>
</html>
